An XML Short Course


In general, data structures are constructed with three kinds of information.

  1. The Data in the various elements of the data structure.
  2. The Relationships between the various elements. (the position of a number in an array )
  3. The "MetaData".

A Working definition: MetaData is data which describes the nature of, or gives information about a datastructure.

Example: If the data structure is a book. The Data might text blocks, chapter headings, title etc. The Relationships might be the chapters and order of chapters in which the text or headings appear. The MetaData associated with the book might be the name of the publisher, the Library of Congress number of the book, or font used to print or epublish the book.

The W3schools Tutorial

XML - eXtensible Markup Language

XML is ideal for large and complex documents. It not only lets you specify a vocabulary for the document, but also sets you specify the relations between elements. For example, if you're putting together a Web page of sales contacts, you can require that every contact has a phone number and an e-mail address.

XML also provides a client-side include mechanism that can integrate date from muliple sources and display it as a single document.

Tim Bray was a prime mover in the development of XML......Bray wanted the following:


A Simple XML document:

<?xml version = "1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="./HelloWorld.xsl"?>
<greeting  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="HelloWorld.xsd">
    Hello World
</greeting>

HelloWorld.xsd

 
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified" attributeFormDefault="unqualified" vc:minVersion="1.1">
    <xs:element name="greeting"  type="xs:string" />
</xs:schema>

HelloWorld.xsl

 
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <html>
            <body>
                <center>
                <h1>
                    <xsl:value-of select="greeting"/>
                </h1>
                </center>
                </body>
                </html>
              </xsl:template >  
</xsl:stylesheet>

Try HelloWorld.xml (There is an interesting Browser issue here. Look at the "page source" in Firefox and IE).

Terminology (informal)